package com.mark.maven.ddd.adapter.web;

import com.mark.maven.ddd.app.CreateOrderService;
import com.mark.maven.ddd.app.dto.req.CreateOrderRequest;
import com.mark.maven.ddd.app.dto.resp.BaseResponse;
import com.mark.maven.ddd.app.dto.resp.OrderInfo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class CreateOrderWebController {

    private final CreateOrderService createOrderService;

    public CreateOrderWebController(CreateOrderService createOrderService) {
        this.createOrderService = createOrderService;
    }

    @PostMapping("/create")
    public BaseResponse<OrderInfo> createOrder(@RequestBody CreateOrderRequest request) {
        return createOrderService.createOrder(request);
    }
}
